package javaDemo;

import java.io.*;
import java.util.Properties;

public class PropertiesDemo {

    public static void main(String[] args) throws IOException {

       // myStore();

        myLoad();
    }

    private static void myLoad() throws IOException {
        Properties properties = new Properties();
        FileReader fileReader = new FileReader("G:\\workspaces\\JavaStudy\\user.xml");
        properties.load(fileReader);
        System.out.println(properties);

    }

    private static void myStore() throws IOException {
        Properties properties = new Properties();
        properties.setProperty("username","张三");
        properties.setProperty("password","1qaz2wsx");



        FileWriter fileWriter = new FileWriter("G:\\workspaces\\JavaStudy\\user.xml");
       // BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream("G:\\workspaces\\JavaStudy\\user.xml"));
       // properties.storeToXML(outputStream,null);

        properties.store(fileWriter,null);
        fileWriter.close();

       // properties.st

    }
}
